package com.cmsz.cashier.utils;

import java.util.HashMap;
import java.util.Map;

import com.cmsz.cashier.bean.CashierOrderInoBean;
import com.cmsz.framework.util.KeyValueUtil;

public class ParamUtil {

	public static String genPageParamSignStr(CashierOrderInoBean orderBean){
		Map<String, String> map = new HashMap<>(64);
		
		map.put("ActivityCode", orderBean.getActivityCode());
		map.put("ReqSys", orderBean.getReqSys());
		map.put("ReqDate", orderBean.getReqDate());
		map.put("ReqTransId", orderBean.getReqTransId());
		map.put("ReqDateTime", orderBean.getReqDateTime());
		map.put("OrderNo", orderBean.getOrderNo());
		map.put("BuyerId", orderBean.getBuyerId());
		map.put("IDType", orderBean.getIdType());
		map.put("IDValue", orderBean.getIdValue());
		map.put("OrderMoney", orderBean.getOrderMoney().toString());
		map.put("Payment", orderBean.getPayment().toString());
		map.put("Gift", orderBean.getGift().toString());
		map.put("MerActivityId", orderBean.getMerActivityId());
		map.put("PaymentLimit", orderBean.getPaymentLimit());
		map.put("ProductId", orderBean.getProductId());
		map.put("ProductName", orderBean.getProductName());
		map.put("ProductDesc", orderBean.getProductDesc());
		map.put("ProductUrl", orderBean.getProductUrl());
		map.put("NotifyUrl", orderBean.getNotifyUrl());
		map.put("ReturnUrl", orderBean.getReturnUrl());
//		map.put("ClientIp", orderBean.getClientIp());
		map.put("CustomParam", orderBean.getCustomParam());

		map.put("WeixinAppId", orderBean.getWeixinAppId());
		/*map.put("WeixinOpenId", orderBean.getWeixinOpenId());*/
		
		return KeyValueUtil.mapToString(map);
	}
	
	public static  Map<String, String> genMerReturnParam(CashierOrderInoBean oriOrderBean){
		
        Map<String, String> rspMap = new HashMap<>();
		rspMap.put("OrderNo", oriOrderBean.getOrderNo());
		rspMap.put("ProductName", oriOrderBean.getProductName());
		rspMap.put("ReqDate", oriOrderBean.getReqDate());
		rspMap.put("ReqTransId", oriOrderBean.getReqTransId());
		rspMap.put("ReturnURL", oriOrderBean.getReturnUrl());
		rspMap.put("OrderMoney", Integer.toString(oriOrderBean.getOrderMoney()));
		rspMap.put("Payment", Integer.toString(oriOrderBean.getPayment()));
		rspMap.put("ProductUrl", oriOrderBean.getProductUrl());
		
		return rspMap;
	}

}
